package com.project.webpage.controller;


import com.github.pagehelper.PageInfo;
import com.project.webpage.aop.TagLog;
import com.project.webpage.dto.LineDailyRankParam;
import com.project.webpage.dto.SearchByMonthParam;
import com.project.webpage.dto.SearchByRqRangeParam;
import com.project.webpage.service.LineOperationService;
import com.project.webpage.util.RestResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/webpage/line/operation")
public class LineOperationController extends BaseController {

    @Resource
    LineOperationService lineOperationService;

    /**
     * 线路监管数据自定义考评列表查询
     */
    @PostMapping("daily/page")
    @TagLog(operation = 0, content = "查询线路监管数据自定义考评列表")
    public RestResult dailyPage(@RequestBody SearchByRqRangeParam param) {
        this.getPage(true, param);
        return RestResult.ok(new PageInfo<>(lineOperationService.getDailyListForPage(param)));
    }

    /**
     * 线路监管数据自定义考评导出列表
     */
    @PostMapping("daily/output")
    @TagLog(operation = 5, content = "导出线路监管数据自定义考评列表")
    public RestResult dailyOutput(@RequestBody SearchByRqRangeParam param) {
        this.getPage(false, param);
        return RestResult.ok(lineOperationService.getDailyListForPage(param));
    }

    /**
     * 线路监管数据月考评列表查询
     */
    @PostMapping("monthly/page")
    @TagLog(operation = 0, content = "查询线路监管数据月考评列表")
    public RestResult monthlyPage(@RequestBody SearchByMonthParam param) {
        this.getPage(true, param);
        return RestResult.ok(new PageInfo<>(lineOperationService.getMonthlyListForPage(param)));
    }

    /**
     * 线路监管数据月考评导出列表
     */
    @PostMapping("monthly/output")
    @TagLog(operation = 5, content = "导出线路监管数据月考评列表")
    public RestResult monthlyOutput(@RequestBody SearchByMonthParam param) {
        this.getPage(false, param);
        return RestResult.ok(lineOperationService.getMonthlyListForPage(param));
    }


    /**
     * 线路监管数据排行列表查询
     */
    @PostMapping("daily/rank/page")
    @TagLog(operation = 0, content = "查询线路监管数据排行列表")
    public RestResult dailyRankPage(@RequestBody LineDailyRankParam param) {
        this.getPage(false, param);
        return RestResult.ok(lineOperationService.getDailyRankListForPage(param));
    }
}
